Exception in thread "main" javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching img.wakzz.cn found. at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1836) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:287) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:281) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1339) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:203) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:848) at sun.security.ssl.Handshaker.process_record(Handshaker.java:784) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1012) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1320) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1347) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1331) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:432) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153) at Application.main(Application.java:8) Caused by: java.security.cert.CertificateException: No subject alternative DNS name matching img.wakzz.cn found. at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:208) at sun.security.util.HostnameChecker.match(HostnameChecker.java:94) at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:285) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:271) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1318) ... 11 more
publicstaticvoidmain(String[] args)throws Exception { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("https://img.wakzz.cn/202004/20200407152546.jpg"); HttpResponse response = httpClient.execute(httpGet); System.out.println(response.getEntity().getContentLength()); }
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Exception in thread "main" javax.net.ssl.SSLException: hostname in certificate didn't match: <img.wakzz.cn> != <img.ucdl.pp.uc.cn> OR <img.ucdl.pp.uc.cn> OR <iscsi.ucdl.pp.uc.cn> OR <slient.ucdl.pp.uc.cn> OR <alissl.ucdl.pp.uc.cn> OR <cdn.osupdateservice.yunos.com> OR <oss.ucdl.pp.uc.cn> at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:228) at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:149) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:130) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:572) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:641) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784) at Application.main(Application.java:18)